home *** CD-ROM | disk | FTP | other *** search
- function lib_bwcheck()
- { //Browsercheck (needed)
- this.ver=navigator.appVersion
- this.agent=navigator.userAgent
- this.dom=document.getElementById?1:0
- this.opera5=this.agent.indexOf("Opera 5")>-1
- this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
- this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
- this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
- this.ie=this.ie4||this.ie5||this.ie6
- this.mac=this.agent.indexOf("Mac")>-1
- this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
- this.ns4=(document.layers && !this.dom)?1:0;
- this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
- return this
- }
- var bw=new lib_bwcheck();
-
- function setContent(newcontent, objectname)
- {
- if(document.all)
- {
- var obj=eval(objectname);
- if(obj)
- obj.innerHTML=newcontent;
- else
- alert(objectname+" doesn't exists");
- }
- else if(document.getElementById)
- {
- rng = document.createRange();
- el = document.getElementById(objectname);
- rng.setStartBefore(el);
- htmlFrag = rng.createContextualFragment(newcontent);
- while(el.hasChildNodes())
- el.removeChild(el.lastChild);
- el.appendChild(htmlFrag);
- }
- }
-
- function lib_obj(obj,nest,dnest,ddnest,num)
- {
- if(!bw.ns4)
- this.evnt=bw.dom && document.getElementById(obj)||bw.ie4 && document.all[obj];
- else
- {
- if(ddnest)
- {
- this.evnt=document[nest].document[dnest].document[ddnest].document[obj]?document[nest].document[dnest].document[ddnest].document[obj]:0;
- }
- else if(dnest)
- {
- this.evnt=document[nest].document[dnest].document[obj]?document[nest].document[dnest].document[obj]:0;
- }
- else if(nest)
- {
- this.evnt=document[nest].document[obj]?document[nest].document[obj]:0;
- }
- else
- {
- this.evnt=document.layers[obj]?document.layers[obj]:0;
- }
- }
- if(!this.evnt)
- return lib_message('The layer does not exist ('+obj+') - Exiting script\n\nIf your using Netscape please check the nesting of your tags!');
- this.elm = bw.ns4?eval(nest+"document.layers." +obj):bw.ie4?document.all[obj]:document.getElementById(obj);
- this.css = bw.ns4?this.elm:this.elm.style;
- this.scrollWidth = bw.ns4?this.css.document.width:this.elm.offsetWidth;
- this.x = bw.ns4?this.css.left:this.elm.offsetLeft;
- this.y = bw.ns4?this.css.top:this.elm.offsetTop;
- if(!bw.bw)
- return lib_message('Old browser');
- this.css=bw.dom||bw.ie4?this.evnt.style:this.evnt;
- this.ref=bw.dom||bw.ie4?document:this.css.document;
- this.w=this.evnt.offsetWidth||this.css.clip.width||this.ref.width||this.css.pixelWidth||0;
- this.h=this.evnt.offsetHeight||this.css.clip.height||this.ref.height||this.css.pixelHeight||0;
- this.moveIt=lib_moveIt;
- this.moveBy=lib_moveBy;
- this.resize=lib_resize;
- this.showIt=lib_showIt;
- this.hideIt=lib_hideIt;
- this.num=num;
- this.clipTo=lib_clipTo;
- this.obj = obj + "Object";
- eval(this.obj + "=this");
- return this
- }
-
- function lib_clipTo(t,r,b,l,setwidth)
- {
- if(t<0) t=0;
- if(r<0) r=0;
- if(b<0) b=0;
- if(l<0) l=0;
- this.ct=t;
- this.cr=r;
- this.cb=b;
- this.cl=l
- if(bw.ns4)
- {
- this.css.clip.top=t;
- this.css.clip.right=r;
- this.css.clip.bottom=b;
- this.css.clip.left=l;
- }
- else if(bw.opera5)
- {
- this.css.pixelWidth=r;
- this.css.pixelHeight=b;
- this.w=r;
- this.h=b;
- }
- else
- {
- this.css.clip="rect("+t+","+r+","+b+","+l+")";
- if(setwidth)
- {
- this.css.width=r;
- this.css.height=b;
- this.w=r;
- this.h=b;
- }
- }
- }
-
- function lib_doc_size()
- { //Page positions - needed!
- this.x=0;this.x2=bw.ie && document.body.offsetWidth-20||innerWidth||0;
- if(bw.ns6) this.x2-=2;
- this.y=0;this.y2=bw.ie && document.body.offsetHeight-5||innerHeight||0;
- if(bw.ns6) this.y2-=4;
- if(!this.x2||!this.y2) return message('Document has no width or height');
- this.x50=this.x2/2; this.y50=this.y2/2;
- this.x10=(this.x2*10)/100;
- this.y10=(this.y2*10)/100;
- this.ytop=140*100/this.y2;
- this.avail=(this.y2*(100-this.ytop))/100;
- this.origy=this.y2;
- return this;
- }
- function lib_moveIt(x,y)
- {
- this.x=x;
- this.y=y;
- this.css.left=x;
- this.css.top=y;
- }
- function lib_moveBy(x,y)
- {
- this.moveIt(this.x+x,this.y+y);
- }
- function lib_resize(w,h)
- {
- if(h<0) h=0;
- if(w<0) w=0;
- this.w=w;
- this.h=h;
- this.css.width=w;
- this.css.height=h;
- }
- function lib_showIt()
- {
- this.css.visibility="visible";
- }
- function lib_hideIt()
- {
- this.css.visibility="hidden";
- }
-